clc;
nCount=0;
%Text=[2 2 3 0 1 2 3 4 1 2 0 1 2 3 4 1 2 3 4 1 2 4 5];
Text=[2 2 3 0 1 2 3 4 1 2 0 1 2 3 4 1 2 3 0 1 2 3 4];
Pattern=[1 2 3 4];
[orw_t,c_t]=size(Text);
[orw_p,c_p]=size(Pattern);
m=1;
n=1;
len =1;
while len<=23
    if Pattern(n)==Text(m)
        if n == 4
            disp(num2str(m-n+1));
            n=1;
            m=m+1;
        else
            n=n+1;
            m=m+1;
        end
       
    else
        m=m+1;
        n=1;        
    end
     len = m
end
